package com.baobao.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */
@IdClass(com.baobao.domain.CoursePK.class)
@Entity
@NamedQueries({
		@NamedQuery(name = "findAllCourses", query = "select myCourse from Course myCourse"),
		@NamedQuery(name = "findCourseByBanjiId", query = "select myCourse from Course myCourse where myCourse.banjiId = ?1"),
		@NamedQuery(name = "findCourseByBanjiIdContaining", query = "select myCourse from Course myCourse where myCourse.banjiId like ?1"),
		@NamedQuery(name = "findCourseByEndTime", query = "select myCourse from Course myCourse where myCourse.endTime = ?1"),
		@NamedQuery(name = "findCourseByEndTimeContaining", query = "select myCourse from Course myCourse where myCourse.endTime like ?1"),
		@NamedQuery(name = "findCourseByName", query = "select myCourse from Course myCourse where myCourse.name = ?1"),
		@NamedQuery(name = "findCourseByNameContaining", query = "select myCourse from Course myCourse where myCourse.name like ?1"),
		@NamedQuery(name = "findCourseByPrimaryKey", query = "select myCourse from Course myCourse where myCourse.banjiId = ?1 and myCourse.weekDay = ?2 and myCourse.seqNo = ?3"),
		@NamedQuery(name = "findCourseBySeqNo", query = "select myCourse from Course myCourse where myCourse.seqNo = ?1"),
		@NamedQuery(name = "findCourseByStartTime", query = "select myCourse from Course myCourse where myCourse.startTime = ?1"),
		@NamedQuery(name = "findCourseByStartTimeContaining", query = "select myCourse from Course myCourse where myCourse.startTime like ?1"),
		@NamedQuery(name = "findCourseByWeekDay", query = "select myCourse from Course myCourse where myCourse.weekDay = ?1") })
@Table(catalog = "baobaodb", name = "course")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "bb/com/baobao/domain", name = "Course")
public class Course implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "banjiId", length = 40, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String banjiId;
	/**
	 */

	@Column(name = "weekDay", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer weekDay;
	/**
	 */

	@Column(name = "seqNo", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer seqNo;
	/**
	 */

	@Column(name = "name", length = 30)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String name;
	/**
	 */

	@Column(name = "startTime", length = 20)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String startTime;
	/**
	 */

	@Column(name = "endTime", length = 20)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String endTime;

	/**
	 */
	public void setBanjiId(String banjiId) {
		this.banjiId = banjiId;
	}

	/**
	 */
	public String getBanjiId() {
		return this.banjiId;
	}

	/**
	 */
	public void setWeekDay(Integer weekDay) {
		this.weekDay = weekDay;
	}

	/**
	 */
	public Integer getWeekDay() {
		return this.weekDay;
	}

	/**
	 */
	public void setSeqNo(Integer seqNo) {
		this.seqNo = seqNo;
	}

	/**
	 */
	public Integer getSeqNo() {
		return this.seqNo;
	}

	/**
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 */
	public String getName() {
		return this.name;
	}

	/**
	 */
	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	/**
	 */
	public String getStartTime() {
		return this.startTime;
	}

	/**
	 */
	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	/**
	 */
	public String getEndTime() {
		return this.endTime;
	}

	/**
	 */
	public Course() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Course that) {
		setBanjiId(that.getBanjiId());
		setWeekDay(that.getWeekDay());
		setSeqNo(that.getSeqNo());
		setName(that.getName());
		setStartTime(that.getStartTime());
		setEndTime(that.getEndTime());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("banjiId=[").append(banjiId).append("] ");
		buffer.append("weekDay=[").append(weekDay).append("] ");
		buffer.append("seqNo=[").append(seqNo).append("] ");
		buffer.append("name=[").append(name).append("] ");
		buffer.append("startTime=[").append(startTime).append("] ");
		buffer.append("endTime=[").append(endTime).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((banjiId == null) ? 0 : banjiId.hashCode()));
		result = (int) (prime * result + ((weekDay == null) ? 0 : weekDay.hashCode()));
		result = (int) (prime * result + ((seqNo == null) ? 0 : seqNo.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Course))
			return false;
		Course equalCheck = (Course) obj;
		if ((banjiId == null && equalCheck.banjiId != null) || (banjiId != null && equalCheck.banjiId == null))
			return false;
		if (banjiId != null && !banjiId.equals(equalCheck.banjiId))
			return false;
		if ((weekDay == null && equalCheck.weekDay != null) || (weekDay != null && equalCheck.weekDay == null))
			return false;
		if (weekDay != null && !weekDay.equals(equalCheck.weekDay))
			return false;
		if ((seqNo == null && equalCheck.seqNo != null) || (seqNo != null && equalCheck.seqNo == null))
			return false;
		if (seqNo != null && !seqNo.equals(equalCheck.seqNo))
			return false;
		return true;
	}
}
